package com.cy.factory;

import com.cy.service.RemoteProviderService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class ServiceDegradationFactory implements FallbackFactory<RemoteProviderService> {
    @Override
    public RemoteProviderService create(Throwable throwable) {
        return new RemoteProviderService() {
            @Override
            public String echMg(String msg) {
               return "参数不合法,调用失败"+throwable.getMessage();
            }

            @Override
            public String doUpdate(Map<String, Object> map) {
                return "参数不合法,修改失败"+throwable.getMessage();
            }
        };
    }
}
